package br.com.sgc.dao;

import java.util.Date;

import javax.ejb.Stateless;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import br.com.sgc.entities.financeiro.Caixa;
import br.com.sgc.entities.geral.Clinica;

@Stateless
public class CaixaDao extends GenericDao<Caixa> {

	private static final long serialVersionUID = 8592673049122388895L;

	public Caixa findByDate(Clinica clinica, Date date) {
		Criteria criteria = getCriteria(Caixa.class);
		criteria.add(Restrictions.eq("clinica.id", clinica.getId()));
		criteria.add(Restrictions.eq("dataCaixa", date));
		return (Caixa) criteria.uniqueResult();
	}

}
